package cn.shyouchi.wuguanjia.android.ui.event.rank;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/10/28 at 10:44
 * Email: 472279981@qq.com
 * Des:
 */

public class RankAdapter extends BaseQuickAdapter<EventRankEntity.ResultMessageBean,BaseViewHolder> {

    EventRankContract.View mView;
    public RankAdapter(List<EventRankEntity.ResultMessageBean> data, EventRankContract.View view) {

        super(R.layout.item_event_rank_layout, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final EventRankEntity.ResultMessageBean entity) {
        holder.setText(R.id.tv_rank_name, entity.getServicesname());

        holder.setText(R.id.tv_rank_time_range, String.format("%1s ~ %2s", entity.getStarttime(), entity.getEndtime()));

//        holder.itemView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                mView.onItemClick(entity);
//            }
//        });

        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onDelClick(entity);
            }
        });
        holder.getView(R.id.img_rank_edit).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onItemClick(entity);
            }
        });

    }
}
